import cn.donting.jme.edit.attribute.Attribute;
import cn.donting.jme.edit.attribute.StringAttribute;
import cn.donting.jme.edit.scene.ControlAttributesMapper;
import cn.donting.jme.edit.scene.ControlMapper;
import cn.donting.jme.edit.ui.inspector.InspectorView;
import com.jme3.export.Savable;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.export.binary.BinaryImporter;
import com.jme3.scene.Node;
import javafx.application.Application;
import javafx.stage.Stage;

import java.io.File;
import java.util.ArrayList;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        InspectorView inspectorView = new InspectorView();
        inspectorView.nowSpatial = new Node();
        inspectorView.addController(new TestControl());
        ControlMapper userData = inspectorView.nowSpatial.getUserData(ControlMapper.key);
        ControlAttributesMapper controlAttributesMapper = userData.getControlAttributesMappers().get(0);

        ArrayList<Attribute> attributes = controlAttributesMapper.getAttributes();
        Attribute attribute = (StringAttribute)attributes.get(0);
        attribute.setValue("asas啊啊");

        BinaryExporter binaryExporter=new BinaryExporter();
        File file = new File("D:\\test\\jmonkeyengine-edit\\test.j3e");
        binaryExporter.save( inspectorView.nowSpatial,file);

        BinaryImporter binaryImporter=new BinaryImporter();

        Savable load = binaryImporter.load(file);


        System.out.println();
    }
}
